import request from '@/utils/request'

// 图片上传API
export const uploadApi = {
  // 上传单张图片
  uploadImage(file, type = 'activity') {
    const formData = new FormData()
    formData.append('file', file)
    formData.append('type', type)
    
    return request({
      url: '/v1/upload/image',
      method: 'POST',
      data: formData,
      headers: {
        'Content-Type': 'multipart/form-data'
      }
    })
  },

  // 批量上传图片
  uploadMultiple(files, type = 'activity') {
    const formData = new FormData()
    files.forEach(file => {
      formData.append('files', file)
    })
    formData.append('type', type)
    
    return request({
      url: '/v1/upload/multiple',
      method: 'POST',
      data: formData,
      headers: {
        'Content-Type': 'multipart/form-data'
      }
    })
  }
} 